/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package swengine;

import java.net.URL;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;

/**
 *
 * @author Patrik
 */
public class SSimpleSound
{
	public static synchronized void playSound(final URL url)
	{
		new Thread(new Runnable()
		{
			public void run()
			{
				try
				{
					Clip clip = AudioSystem.getClip();
					AudioInputStream inputStream = AudioSystem.getAudioInputStream(url);
					clip.open(inputStream);
					clip.start();
				}
				catch (Exception e)
				{
					System.err.println(e.getMessage());
				}
			}
		}).start();
	}
}
